Register or update a Task.
#Include <TaskScheduler.au3>
_TS_TaskRegister($oService, $sFolder, $sName, $oTaskDefinition, $sUserId = "", $sPassword = "", $iLogonType = Default, $iCreateFlag = $TASK_CREATE)
Parameters
| $oService | Task Scheduler Service object as returned by _TS_Open |
| $sFolder | Folder where the Task should be created |
| $sName | Name of the Task |
| $oTaskDefinition | Task Definition object as created by _TS_TaskCreate and filled by _TS_TaskPropertiesSet |
| $sUserId | [optional] The user credentials that are used to register the Task. If present, these credentials |
| $sPassword | [optional] The password for the UserId that is used to register the Task. When the TASK_LOGON_SERVICE_ACCOUNT logon type |
| $iLogonType | [optional] Can be any of the TASK_LOGON_TYPE constants enumeration. For the default please check Remarks |
| $iCreateFlag | [optional] Defines if to create or update the task. Can be any of the TASK_CREATE constants enumeration. Default is $TASK_CREATE |
Return Value
Success: Task object
Remarks
If the logon type has been set in the Principal sub-object then $TASK_LOGON_NONE is the default to not overwrite the existing setting.
Related
Example
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker
#AutoIt3Wrapper_AU3Check_Stop_OnWarning=y
#AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <MsgBoxConstants.au3>
MsgBox($MB_ICONINFORMATION, "Task Scheduler UDF", "Please check example script _TS_TaskCreate.au3 for how to use _TS_TaskRegister!")